package Model;

import java.util.ArrayList;
import java.util.List;

import org.simpleframework.xml.ElementList;
import org.simpleframework.xml.Root;
@Root
public class Autorzy {
	@ElementList(entry="autor", inline=true)
	private List<Autor> autor;

	public Autorzy() {
		this.autor = new ArrayList<Autor>();
	}

	@Override
	public String toString() {
		return "Autorzy [autorzy=" + autor + "]";
	}
	
	public void addAuthor(String imie, String nazwisko, int numer_indeksu){
		String max = this.autor.get(this.autor.size()-1).getAutor_id();
		int new_id = Integer.parseInt(max.substring(1, max.length())) + 1;
		this.autor.add(new Autor("s"+new_id, imie, nazwisko, numer_indeksu));
	}
	
	
	
}
